/*************************************************************************
  > File Name: TwoDieVector.cpp
  > Author: 16hxliang3
  > Mail: 16hxliang3@stu.edu.cn
  > Created Time: Mon 16 May 2022 08:15:12 PM CST
 ************************************************************************/

#include <climits>
#include <cstdint>
#include <iostream>
#include <vector>
struct test
{
    uint32_t a, b;
};
struct testv
{
    uint32_t a = UINT_MAX;
    uint32_t b;
    std::vector<uint32_t> as;
    std::vector<uint32_t> bs;
};
struct testva
{
    uint32_t a = UINT_MAX;
    std::vector<uint32_t> as;
};
struct testvb
{
    uint32_t b;
    std::vector<uint32_t> bs;
};
int main()
{
  u_int32_t lim = 30000000;
  std::vector<testv> a(lim);
  std::vector<std::vector<test>> b(lim, std::vector<test>(1));
  std::vector<testva> c(lim);
  std::vector<testvb> d(lim);
  auto start = clock();
  for(auto i = 0; i < lim; i++)
  {
    if(i > 30000)
    {
      a[i].a = 3;
      a[i].b = 3;
    }
    else
    {
      a[i].as.push_back(33);
      a[i].bs.push_back(33);
    }
  }
  auto finish = clock();
  std::cout << finish - start << std::endl;
  test t = { 3, 3 };
  start = clock();
  for(auto i = 0; i < lim; i++)
  {
    if(i > 30000)
      b[i][0] = t;
    else
      b[i].push_back(t);
  }
  finish = clock();
  std::cout << finish - start << std::endl;
  start = clock();
  for(auto i = 0; i < lim; i++)
  {
    if(i > 30000)
    {
      c[i].a = 3;
      d[i].b = 3;
    }
    else
    {
      c[i].as.push_back(33);
      d[i].bs.push_back(33);
    }
  }
  finish = clock();
  std::cout << finish - start << std::endl;
}
